# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apostrophe
pkgver=2.6.3
pkgrel=4
pkgdesc="distraction free Markdown editor for GNU/Linux made with GTK+"
url="https://gitlab.gnome.org/World/apostrophe"
arch="aarch64 x86_64" # py3-pypandoc
license="GPL-3.0-or-later"
depends="
	font-fira-otf
	gspell
	gtk+3.0
	libhandy1
	py3-cairo
	py3-chardet
	py3-enchant
	py3-gobject3
	py3-levenshtein
	py3-pypandoc
	py3-regex
	py3-setuptools
	webkit2gtk
	"
makedepends="meson gtk+3.0-dev gobject-introspection-dev gspell-dev gettext-dev
	libhandy1-dev sassc"
checkdepends="appstream-glib desktop-file-utils"
subpackages="$pkgname-lang"
source="https://gitlab.gnome.org/World/apostrophe/-/archive/v$pkgver/apostrophe-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"

prepare() {
	default_prepare
	# fix font finding
	sed -i 's|/app/share/fonts/FiraSans-Regular.ttf|/usr/share/fonts/OTF/FiraSans-Regular.otf|' \
		data/media/css/web/base.css
	sed -i 's|/app/share/fonts/FiraMono-Regular.ttf|/usr/share/fonts/OTF/FiraMono-Regular.otf|' \
		data/media/css/web/base.css

}

build() {
	abuild-meson . output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
1820fd609efe4ac0b7babdeb2aa552a72dd9623f4caeb8eb9e638a52a546b76fda5119931d10b630234a595d227ff7090a63503fd9da94d553439b91a03ac876  apostrophe-v2.6.3.tar.gz
"
